var basesUrl = 'http://47.108.197.28:3000';
function http(url){
  return new Promise((resolve,reject)=>{
  wx.request({
    url:basesUrl+url,
    header: {'content-type':'application/json'},
    method: 'GET',
    dataType: 'json',
    responseType: 'text',
    success:(res)=>{
      resolve(res)
    },
    error:(err)=>{
      reject(err)
    }
  })
});
}
function handleStr(str){
  if(str.length>6){
    str.slice(0,6)+"..."
  }
  return str
}
function getMusicHttp(){
  return http("/top/playlist")
}
function getMvHttp(){
  return http("/mv/first")
}
module.exports = {
  getMusicHttp,
  getMvHttp,
  handleStr
}

